//
//  PGHotCommentView.m
//  youqu
//
//  Created by 彭鹏 on 16/10/17.
//  Copyright © 2016年 pengpeng. All rights reserved.
//

#import "PGHotCommentView.h"
#import "PGPostItem.h"
#import "PGTopCommentItem.h"
#import "PGUserItem.h"

@interface PGHotCommentView ()
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UIView *contentView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIButton *voiceButton;

@end
@implementation PGHotCommentView

+ (instancetype)hotCommentView {
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}


- (void)setItem:(PGPostItem *)item {
    _item = item;
    if (item.topCommentItem.content.length) {
        _contentView.hidden= YES;
        _contentLabel.hidden = NO;
        _contentLabel.text = item.topCommentItem.totalContent;
    }else {
        _contentLabel.hidden = YES;
        _contentView.hidden = NO;
        
        NSUInteger voicetime = item.topCommentItem.voicetime;
        _nameLabel.text = item.topCommentItem.user.username;
        [_voiceButton setTitle:[NSString stringWithFormat:@"%zd'",voicetime] forState:UIControlStateNormal];
        
        
    }
    
    
    
}



@end
